import { request } from 'umi'
import { CurrentUser } from './data';

export async function queryCurrent(): Promise<{ data: CurrentUser }> {
  return request('/api/user/info');
}

// 用户修改基本信息
export async function editUser(data: Record<string, any>, options?: Record<string, any>) {
  return request('/api/user/selfUpdate', {
    data,
    method: 'PUT',
    ...(options || {}),
  });
}

// 用户修改密码
export async function editPassword(data: Record<string, any>, options?: Record<string, any>) {
  return request('/api/user/changePassword', {
    data,
    method: 'POST',
    ...(options || {}),
  });
}
